from abc import ABC
from common.utils.session import Session
import tornado.web
from typing import Optional, Awaitable


class RequestHandler(tornado.web.RequestHandler, ABC):
    def __init__(self, application, request, **kwargs):
        super(RequestHandler, self).__init__(application, request, *kwargs)
        self.session = Session(session_id='123456')

    def data_received(self, chunk: bytes) -> Optional[Awaitable[None]]:
        pass

    def set_default_headers(self) -> None:
        self.set_header('Access-Control-Allow-Origin', '*')
        self.set_header('Access-Control-Allow-Headers', '*')

    def options(self, *args, **kwargs):
        self.set_status(200)
